<template>
  <div>
    <PicturePop v-model="showExpirePop" :url="url" :picture="configInfo.imgUrl"/>
  </div>
</template>

<script>
import PicturePop from "@/components/public/PicturePop.vue";

export default {
  components: {PicturePop},
  data() {
    return {
      showExpirePop: false,
      picture: require("@/assets/images/public/test-pop-pic.png"),
      configInfo: {},
      url: "",
    }
  },
  created() {
    this.getFinancialTips()
  },
  methods: {
    async getFinancialTips() {
      const url = this.URL.financial.tips
      const res = await this.$post(url)
      if (res.code != 0) return;
      let {hasRedeem, orderId, productCanRepeatBuy} = res.data
      if (hasRedeem) {
        //OnReinvestment:不复投   Reinvestment:复投
        let type = productCanRepeatBuy? 'Reinvestment' : 'OnReinvestment'
        this.url = `/invest/detail?orderId=${orderId}`;
        await this.getDetail(type)
        this.showExpirePop = true;
      }

    },
    async getDetail(type) {
      const url = this.URL.home.ads
      const res = await this.$post(url, {positionKey: type})
      if (res.code != 0) return;
      this.configInfo = res.data[0];
    }
  }

}
</script>

<style lang="less" scoped>

</style>